﻿#region Using Statements
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using DotNetEngine.Graphics;
using DotNetEngine.Core;
#endregion

namespace DotNetEngine.GUI
{
    public class MenuItem
    {
        #region Propierties
        public DrawableText Option { get; set; }
        public delegate void actionhandler();
        public actionhandler action;
        #endregion

        #region Initialize methods
        public MenuItem(string text, Vector2 position, Color color, int layer, actionhandler action)
        {
            Option = new DrawableText(text, position, color, layer);
            this.action = action;
        }
        public MenuItem(string text, actionhandler action, int layer)
        {
            Option = new DrawableText(text, Vector2.Zero, Color.Black, layer);
            this.action = action;
        }
        #endregion

        #region Public methods
        public virtual void Draw(Boolean selected)
        {
            if (selected)
            {
                Option.Color = Color.Red;
                Option.Scale = 1.2f;
            }
            else
            {
                Option.Color = Color.Black;
                Option.Scale = 1.0f;
            }
            BaseGame.RenderElements.Add(Option);
        }
        public virtual void Execute()
        {
            action();
        } 
        #endregion
    }
}
